home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_09
/
1009032a
< prev
next >
Wrap
Text File
|
1991-12-17
|
303b
|
14 lines
for (incr = n; swap != 0 || incr > 1; incr = (incr + 1) / 2) {
swap = 1;
while (swap != 0) {
swap = 0;
for (i = 0; i < n - incr; i++)
if (x[i] > x[i + incr]) {
tmp = x[i];
x[i] = x[i + incr];
x[i + incr] = tmp;
swap = 1;
}
}
}
}